<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>关键帧动画-单一属性</title>
    <style>
        div{
            width: 200px;
            height: 200px;
            background: red;
            /* animation:wangrun1 2s linear infinite; */
            /* infinite无限次执行 */

            animation-name: wangrun1;
            animation-duration:2s ;
            animation-timing-function: linear;
            /* animation-delay: 5s; */
            animation-iteration-count: infinite;

            animation-play-state: running;
            /*
             running默认
             paused
             */
             
             animation-direction: alternate-reverse;
             /* 
             normal正常 
             reverse反方向
             alternate正常方向交替
             alternate-reverse反方向交替
             */
        }
        div:hover{
            animation-play-state: paused;
        }


        /* 声明动画 */
        @keyframes wangrun1 {
            from{
                width: 200px;
                height: 200px;
                background: red;
            }
            to{
                width: 400px;
                height: 600px;
                background: green;
            }
        }
        
        /*
         以下声明动画0% to 100%与上者等价
         优点支持多种状态
        */
        @keyframes wangrun2 {
            0%{
                width: 200px;
                height: 200px;
                background: red;
            }
            25%{
                width: 200px;
                height: 400px;
                background: yellow;
            }
            50%{
                width: 400px;
                height: 400px;
                background: blue;
            }
            75%{
                width: 400px;
                height: 500px;
                background: gray;
            }
            100%{
                width: 400px;
                height: 600px;
                background: green;
            }
        }
    </style>
</head>
<body>
    <div></div>
</body>
</html>